home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.3 KB | 55 lines | [TEXT/GEOL] |
- Item 6271673 24-Aug-90 07:25PDT
-
- From: PHAROS.TECH Pharos Tech, Tech Staff,PRT
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: Overriding Beep()
-
- From: Schmitz, Scott D. on Fri, Aug 24, 1990 10:25 AM
- Subject: Overriding Beep()
- To: MacApp
-
- I just wrote some code which overrides the gApplication.Beep() procedure and
- gives the ability to play 'snd ' resources like hypercard. For those who are
- interested here's the code:
-
- • USES the SoundUnit.p which Apple included in their Source Code Example 24.
-
- Put this line in the initialization code for your App.
-
- If InitSoundUnit = 0 Then ;
-
- Put this as the last line in your Main:
- FreeSoundUnit;
-
- Override Beep like so:
-
- {-------------------------------------------------------------}
- {$S MAGlobalsRes}
- {Duration now passes in the 'snd ' resource number}
-
- Procedure TCalcApplication.Beep (duration: Integer); OVERRIDE;
-
- Var
- Err : Integer;
- SndHandle : handle;
-
- Begin
- FreeAllChans;
- SndHandle := Handle(GetResource(soundListRsrc, duration));
- Err := resError;
- If Err = NoErr Then
- Err := HyperSndPlay(SndHandle);
-
- If (Err <> NoErr) Then
- Inherited Beep(duration);
- End;
-
- The sound plays asynchronisly without that annoying click.
-
- Scott
- Pharos Technologies
-
-
-